package com.utc.teamcenter.common.app.dialog.bean;

import javax.swing.JComponent;

import com.teamcenter.rac.common.lov.LOVUIComponent;
import com.teamcenter.rac.stylesheet.PropertyLOVUIComponent;
import com.utc.teamcenter.common.util.EclipseUtil;
import com.utc.teamcenter.common.util.TCUtil;

public class BeanLOVUIComponent extends BeanComponent {

	private LOVUIComponent lov;

	public BeanLOVUIComponent(String key, String name, String type,
			boolean required) {
		super(key, name);

		try {
			this.lov = new LOVUIComponent(TCUtil.getTCSession(), type);

			this.lov.setRequired(required);
		} catch (Exception e) {
			EclipseUtil.error(e);
			e.printStackTrace();
		}
	}
	
	@Override
	public void clear() {
		this.lov.setSelectedValue(null);
	}
	
	public Object getValue() {
		return this.lov.getValue();
	}

	@Override
	public JComponent getComponent() {
		return this.lov;
	}

	@Override
	public String getText() {
		return this.lov.getText();
	}

	@Override
	public boolean isRequired() {
		return this.lov.isRequired();
	}

	@Override
	public void setText(String text) {
		this.lov.setText(text);
	}

	@Override
	public void setRequired(boolean required) {
		this.lov.setRequired(required);
	}

	@Override
	public void requestFocus() {
		this.lov.requestFocus();
	}

	@Override
	public void setEnabled(boolean bool) {
		this.lov.setEnabled(bool);
	}

	@Override
	public void setVisible(boolean bool) {
		this.lov.setVisible(bool);
	}
}
